using System;

namespace SubSpec
{
	public class DisposableAction : IDisposable
	{
		public static readonly DisposableAction None = new DisposableAction(() => { });

		private Action _action;

		public DisposableAction(Action action)
		{
			if (action == null)
				throw new ArgumentNullException("action");

			_action = action;
		}

		public void Dispose()
		{
			_action();
		}
	}
}
